/*
package com.winning.sjzc.common.config;

import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.http.StatViewServlet;
import com.alibaba.druid.support.http.WebStatFilter;
import java.utils.Arrays;
import java.utils.HashMap;
import java.utils.Map;
import javax.sql.DataSource;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;

*/
/**
 * description:
 *
 * @author yanxf@winning.com.cn
 * @date 2019/08/06 15:27
 *//*

@Configuration
@MapperScan(basePackages = "com.winning.sjzc.common.dao.jcgl", sqlSessionTemplateRef = "jcglSqlSessionTemplate")
public class JcglDataSourceConfig {

  @Bean(name = "jcglDataSource")
  @ConfigurationProperties(prefix = "spring.datasource.jcgl")
  @Primary
  public DataSource testDataSource() {
//    return DataSourceBuilder.create().build();
    return new DruidDataSource();
  }

  @Bean(name = "jcglSqlSessionFactory")
  @Primary
  public SqlSessionFactory testSqlSessionFactory(@Qualifier("jcglDataSource") DataSource dataSource)
      throws Exception {
    SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
    bean.setDataSource(dataSource);
    bean.setMapperLocations(new PathMatchingResourcePatternResolver()
        .getResources("classpath:mybatis/mybatis/sqlserver/jcgl/*.xml"));
    return bean.getObject();
  }

  @Bean(name = "jcglTransactionManager")
  @Primary
  public DataSourceTransactionManager testTransactionManager(
      @Qualifier("jcglDataSource") DataSource dataSource) {
    return new DataSourceTransactionManager(dataSource);
  }

  @Bean(name = "jcglSqlSessionTemplate")
  @Primary
  public SqlSessionTemplate testSqlSessionTemplate(
      @Qualifier("jcglSqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {
    return new SqlSessionTemplate(sqlSessionFactory);
  }


*/
/**
 * 配置Druid的监控
 * @return 配置一个管理后台的Servlet
 *//*


    @Bean
    @Primary
    public ServletRegistrationBean statViewServlet(){
        ServletRegistrationBean bean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
        Map<String,String> initParams = new HashMap<>(5);
        initParams.put("loginUsername","admin");
        initParams.put("loginPassword","123456");
        //默认就是允许所有访问
        initParams.put("allow","");
        initParams.put("deny","192.168.15.21");
        bean.setInitParameters(initParams);
        return bean;
    }

*/
/**
 * 配置一个web监控的filter
 * @return filterRegistrationBean
 *//*


    @Bean
    @Primary
    public FilterRegistrationBean webStatFilter(){
        FilterRegistrationBean bean = new FilterRegistrationBean();
        bean.setFilter(new WebStatFilter());
        Map<String,String> initParams = new HashMap<>(1);
        initParams.put("exclusions","*.js,*.css,/druid/*");
        bean.setInitParameters(initParams);
        bean.setUrlPatterns(Arrays.asList("/*"));
        return bean;
    }
}

*/
